package com.ssy.lingxi.platform.template.service.controller.inner;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.template.api.model.dto.inner.MemberShopDTO;
import com.ssy.lingxi.platform.template.api.model.dto.inner.MemberShopListInnerDTO;
import com.ssy.lingxi.platform.template.api.model.dto.inner.MerchantLogoInnerDTO;
import com.ssy.lingxi.platform.template.api.model.dto.inner.UpdateShopStatusDTO;
import com.ssy.lingxi.platform.template.api.model.vo.inner.MemberShopListInnerVO;
import com.ssy.lingxi.platform.template.api.model.vo.inner.MerchantLogoInnerVO;
import com.ssy.lingxi.platform.template.service.service.inner.MemberShopInnerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 会员店铺 - 内部接口
 * @author fhj
 * @version 2.0.0
 * @date 2020/12/09
 */
@Api(tags = "会员店铺 - 内部接口")
@RestController
@RequestMapping("/template/inner/memberShopInner")
public class MemberShopInnerController extends BaseController {

    @Resource
    private MemberShopInnerService memberShopInnerService;

    @ApiOperation(value = "更新店铺（会员名称、注册年数、信用积分、满意度）")
    @PostMapping("/updateShop")
    public Wrapper<Void> updateShop(@RequestBody @Valid MemberShopDTO dto) {
        return memberShopInnerService.updateShop(dto);
    }

    @ApiOperation(value = "更新店铺状态（可以是一个角色的禁用与启用，也可以是一个会员下的某个角色的禁用与启用）")
    @PostMapping("/updateShopStatus")
    public Wrapper<Void>  updateShopStatus(@RequestBody @Valid UpdateShopStatusDTO dto) {
        return memberShopInnerService.updateShopStatus(dto);
    }

    @ApiOperation(value = "店铺列表")
    @PostMapping("/memberShopList")
    public Wrapper<List<MemberShopListInnerVO>> memberShopList(@RequestBody @Valid List<MemberShopListInnerDTO> dto) {
        return memberShopInnerService.memberShopList(dto);
    }
    //TODO:需要调整
    @ApiOperation(value = "根据商城ID获取商家LOGO")
    @PostMapping("/findMerchantLogoByShopId")
    public Wrapper<List<MerchantLogoInnerVO>> findMerchantLogoByShopId(@RequestBody @Valid MerchantLogoInnerDTO dto) {
        return memberShopInnerService.findMerchantLogoByShopId(dto);
    }
}
